Ext.define('passport.view.department.DepartmentListView' ,{
    extend: 'Ext.grid.Panel',
    alias : 'widget.departmentListView',
		store: 'DepartmentStore',
		bodyBorder : false,
		border:0,
		padding: 0,
		frame : true,
		tbar:
		{
	        xtype: 'toolbar',
	        items: [
		        {
		            text: 'New',
		            action: 'create'
		        },
		        {
		         		text: 'Delete',
		            action: 'delete'
		        }
		        ,
		        {
		         		text: 'Refresh',
		            action: 'refresh'
		        }
		      ]
		  },
		  bbar:{
				xtype: 'pagingtoolbar',
				store: 'DepartmentStore',
				dock: 'bottom',
				displayInfo: true	
		  },
		
		listeners: {
			select: function(record) {
				console.log("u selected "+record);
			}
		},
    initComponent: function() {
        this.columns = [
        		{header: 'Id',  dataIndex: 'Id',  width: 60, hidden: true},
            {header: 'Short Name', dataIndex: 'ShortName',  width: 100},
            {header: 'Factory Id',  dataIndex: 'FactoryId',   width: 100},
            
            {header: 'IsActive',  dataIndex: 'IsActive',  width: 10, hidden: true},
            {header: 'CreatedDate', dataIndex: 'CreatedDate',  width: 100, hidden: true},
            {header: 'CreatedBy',  dataIndex: 'CreatedBy',   width: 100, hidden: true},
            
            {header: 'LastModifiedDate',  dataIndex: 'LastModifiedDate',  width: 60, hidden: true},
            {header: 'LastModifiedBy', dataIndex: 'LastModifiedBy',  width: 100, hidden: true},
            {header: 'LastVisitedDate',  dataIndex: 'LastVisitedDate',   width: 100, hidden: true},
            
            {header: 'LastVisitedBy',  dataIndex: 'LastVisitedBy',  width: 60, hidden: true},
            {header: 'DeletedDate', dataIndex: 'DeletedDate',  width: 100, hidden: true},
            {header: 'DeletedBy',  dataIndex: 'DeletedBy',   width: 100, hidden: true}
        ];
        this.callParent(arguments);
    }
    ,
	    listeners:{
	    	itemcontextmenu: function(view,record,item,index,e) {
	    			var contextMenu = new Ext.menu.Menu({
						  items: [
						  {
						    text: 'Create',
						    iconCls: 'edit',
						  },
						  {
						    text: 'Edit '+ record.get("FirstName")+"  " +record.get("LastName"),
						    iconCls: 'edit',
						  },
						  {
						    text: 'Delete',
						    iconCls: 'edit',
						  },
						  {
						    text: 'Set inactive',
						    iconCls: 'edit',
						  }
						  ]
						});
						e.stopEvent();
						contextMenu.showAt(e.getX(), e.getY(), true);
	    	}
	    }
});